<!DOCTYPE html>
<html>
  <head>
    <title>{{resource_name}} API</title>
    <meta charset="utf-8">
    <style>
      {{{ styles }}}
    </style>
  </head>
  <body>
    <div class="container">
      <h1>{{resource_name}} API</h1>
      {{# resource_explanation }}

        <p class="explanation">{{{ resource_explanation }}}</p>
      {{/ resource_explanation }}

      <div class="article">
        <h2>{{ description }}</h2>
        <h3>{{ http_method }} {{ route }}</h3>
        {{# explanation }}
          <p class="explanation">
            {{{ explanation }}}
          </p>
        {{/ explanation }}

        {{# has_parameters? }}
          <h3>Parameters</h3>
          <table class="parameters table table-striped table-bordered table-condensed">
            <thead>
              <tr>
                <th>Name</th>
                <th>Description</th>
              </tr>
            </thead>
            <tbody>
              {{# parameters }}
              <tr>
                <td{{# required }} class="required"{{/ required }}>
                  {{# scope }}
                    <span class="name">{{ scope }}[{{ name }}]</span>
                  {{/ scope }}
                  {{^ scope }}
                    <span class="name">{{ name }}</span>
                  {{/ scope }}
                </td>
                <td>
                  <span class="description">{{ description }}</span>
                </td>
              </tr>
              {{/ parameters }}
            </tbody>
          </table>
        {{/ has_parameters? }}

        {{# has_response_fields? }}
          <h3>Response Fields</h3>
          <table class="response-fields table table-striped table-bordered table-condensed">
            <thead>
              <tr>
                <th>Name</th>
                <th>Description</th>
              </tr>
            </thead>
            <tbody>
              {{# response_fields }}
              <tr>
                <td>
                  {{# scope }}
                    <span class="name">{{ scope }}[{{ name }}]</span>
                  {{/ scope }}
                  {{^ scope }}
                    <span class="name">{{ name }}</span>
                  {{/ scope }}
                </td>
                <td>
                  <span class="description">{{ description }}</span>
                </td>
              </tr>
              {{/ response_fields }}
            </tbody>
          </table>
        {{/ has_response_fields? }}

        {{# requests }}
          <h3>Request</h3>

          {{# request_headers_text }}
            <h4>Headers</h4>
            <pre class="request headers">{{ request_headers_text }}</pre>
          {{/ request_headers_text }}

          <h4>Route</h4>
          <pre class="request route highlight">{{ request_method }} {{ request_path }}</pre>

          {{# request_query_parameters_text }}
            <h4>Query Parameters</h4>
            <pre class="request query_parameters highlight">{{ request_query_parameters_text }}</pre>
          {{/ request_query_parameters_text }}

          {{# request_body }}
            <h4>Body</h4>
            <pre class="request body">{{{ request_body }}}</pre>
          {{/ request_body }}

          {{# curl }}
            <h4>cURL</h4>
            <pre class="request curl">{{ curl }}</pre>
          {{/ curl }}

          {{# response_status }}
            <h3>Response</h3>
            {{# response_headers_text }}
              <h4>Headers</h4>
              <pre class="response headers">{{ response_headers_text }}</pre>
            {{/ response_headers_text }}
            <h4>Status</h4>
            <pre class="response status">{{ response_status }} {{ response_status_text}}</pre>
            {{# response_body }}
              <h4>Body</h4>
              <pre class="response body">{{ response_body }}</pre>
            {{/ response_body }}
          {{/ response_status }}
        {{/ requests }}
      </div>
    </div>
  </body>
</html>
